//
//  PopoverView.h
//  Popover
//
//  Created by lifution on 16/1/5.
//  Copyright © 2016年 lifution. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "PopoverAction.h"



typedef NS_ENUM(NSInteger,PopoverViewAlignmentStyle)
{
    PopoverViewAlignmentStyleDefault,
    PopoverViewAlignmentStyleTop,
    PopoverViewAlignmentStyleLeft,
    PopoverViewAlignmentStyleRight,
    PopoverViewAlignmentStyleBottom,
    PopoverViewAlignmentStyleCenter
};

@interface PopoverView : UIView





@property (nonatomic, assign) BOOL hideAfterTouchOutside; ///< 是否开启点击外部隐藏弹窗, 默认为YES.
@property (nonatomic, assign) BOOL showShade; ///< 是否显示阴影, 如果为YES则弹窗背景为半透明的阴影层, 否则为透明, 默认为NO.
@property (nonatomic, assign) PopoverViewStyle style; ///< 弹出窗风格, 默认为 PopoverViewStyleDefault(白底黑字)
@property (nonatomic, assign) PopoverViewAlignmentStyle alignmentStyle;
/** 背景颜色(style设置为PopoverViewStyleCustom时生效) */
@property (nonatomic, strong) UIColor *viewColor;
/** 字体颜色(style设置为PopoverViewStyleCustom时生效) */
@property (nonatomic, strong) UIColor *fontColor;
/** 分割线颜色(style设置为PopoverViewStyleCustom时生效) */
@property (nonatomic, strong) UIColor *lineColor;



+ (instancetype)popoverView;

/*! @brief 指向指定的View来显示弹窗
 *  @param pointView 箭头指向的View
 *  @param actions   动作对象集合<PopoverAction>
 */
- (void)showToView:(UIView *)pointView withActions:(NSArray<PopoverAction *> *)actions withAlignmentStyle:(PopoverViewAlignmentStyle)alignmentStyle;

/*! @brief 指向指定的点来显示弹窗
 *  @param toPoint 箭头指向的点(这个点的坐标需按照keyWindow的坐标为参照)
 *  @param actions 动作对象集合<PopoverAction>
 */
- (void)showToPoint:(CGPoint)toPoint withActions:(NSArray<PopoverAction *> *)actions withAlignmentStyle:(PopoverViewAlignmentStyle)alignmentStyle;

@end
